# In[1]:	
tup1 = (1, 2, 3, 4)
print(tup1)



# In[2]:
tup2 = ('a', 'b', 'c', 'd')
print(tup2)



# In[3]:	
tup3 = 'a', 'b', 'c', 'd'
print(tup3)



# In[4]:	
tup4 = (1,)
tup5 = ()
print(tup4)
print(tup5)



# In[5]:	
tup6 = ('Python', 'PySpark', 2020, 2021)
print(tup6)



# In[6]:	
tup = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(tup[0])



# In[7]:	
print(tup[10])


# In[8]:	
print(tup[-1])


# In[9]:	
tup = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

# [indexStart:indexEnd]
print(tup[0: 10])



# In[10]:	
# [indexStart:indexEnd, stride]
print(tup[0: 10: 2])



# In[11]:	
list1 = [1, 2, 3, 4]
print(list1)



# In[12]:	
list2 = ['a', 'b', 'c', 'd']
print(list2)



# In[13]:	
list3 = []
print(list3)



# In[14]:	
list4 = ['Python', 'PySpark', 2020, 2021]
print(list4)



# In[15]:	
# 使用索引方式访问单个元素
list1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list1[0])



# In[16]:	
# 使用起止索引方式访问List中的数据，如：[indexStart:indexEnd]
print(list1[0: 10])



# In[17]:	
# 使用起止索引和步长方式访问List中的数据，如：[indexStart:indexEnd,stride]
print(list1[0: 10: 2])



# In[18]:	
list1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list1)



# In[19]:	
list1[2] = 21
print(list1)



# In[20]:	
list1[3:6] = [31, 41, 51]
print(list1)



# In[21]:	del list1[1]
print(list1)



# In[22]:	
dict1 = {'key1': 'value1',
         'key2': 'value2',
         'key3': 'value3'
        }
print(dict1)



# In[23]:	
dict2 = dict([('one', 1),
              ('two', 2),
              ('three', 3)
             ])
print(dict2)



# In[24]:	
dict1 = {'key1': 'value1',
         'key2': 'value2',
         'key3': 'value3'
        }



# In[25]:	
# 使用items方法获取字典中的所有数据项
for (key,value) in dict1.items ():
    print(key + ':' + value)



# In[26]:	
# 使用keys方法获取字典中的key数据项
for key in dict1.keys():
    print(key + ':' + dict1[key])



# In[27]:	
# 访问字典中的单个元素
dict1['key1']



# In[28]:	
dict1 = {'key1': 'value1',
         'key2': 'value2',
         'key3': 'value3'
        }
dict1['key1'] = '10'
print(dict1['key1'])



# In[29]:	
del dict1['key1']
print(dict1)



# In[30]:	
f = lambda x: x + 1
print(f(1))



# In[31]:	
y = lambda x: [x, x + 1, x + 2]
y(1)



# In[32]:	
print(list(map(lambda x: x ** 2, [1, 2, 3, 4])))



# In[33]:	
print(list(filter(lambda x: x % 2 == 0, [1, 2, 3, 4])))



# In[34]:	
from functools import reduce

print(reduce(lambda x, y: x + y, [1, 2, 3, 4, 5]))



